package com.example.aacwebdemo.jdk.v9.g;

/**
 * @author zhao.xin06679
 * @date 2021年06月29日 16:24
 */
public class HttpClientTest {

//    public static void main(String[] args) {
//        //jdk 9 中 使用 HttpClient替换原有的HttpURLConnection
//        try {
//            HttpClient client = HttpClient.newHttpClient();
//            HttpRequest req = HttpRequest.newBuilder(URI.create("https://www.baidu.com/")).GET().build();
//            HttpResponse<String> response = null;
//            response = client.send(req, HttpResponse.BodyHandler.asString());
//            System.out.println(response.statusCode());
//            System.out.println(response.version().name());
//            System.out.println(response.body());
//        } catch (IOException e) {
//            e.printStackTrace();
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
//    }


}
